using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DBCManager{

    private static DBCManager mInstance;
    protected DBCReader groundDBC;
    protected DBCReader wallTypeDBC; 
    protected DBCReader wallDBC;
    protected DBCReader otherDBC;
    protected DBCReader woodenWallDBC;
    //单例
    public static DBCManager GetInstance()
    {
        if (mInstance == null)
        {
            mInstance = new DBCManager();
            mInstance.Init();
        }
        return mInstance;
    }
    private DBCManager()
    {
    }

    public DBCReader GetGroundDBC() { return groundDBC; }
    public DBCReader GetWallTypeDBC() { return wallTypeDBC; }
    public DBCReader GetWallDBC() { return wallDBC; }
    public DBCReader GetOtherDBC() { return otherDBC; }
    public DBCReader GetWoodenWallDBC() { return woodenWallDBC; }
    
    

    void Init(){
        if(groundDBC == null)
        {
            groundDBC = new DBCReader();
            groundDBC.ReadFile("Table/ground");
        }
        if(wallTypeDBC == null) 
        {
            wallTypeDBC = new DBCReader();   
            wallTypeDBC.ReadFile("Table/wallType");
        }
        if(wallDBC == null) 
        {
            wallDBC = new DBCReader();
            wallDBC.ReadFile("Table/wall");
        }
        if(otherDBC == null)
        {
            otherDBC = new DBCReader();
            otherDBC.ReadFile("Table/other");
        }
        if(woodenWallDBC == null)
        {
            woodenWallDBC = new DBCReader();
            woodenWallDBC.ReadFile("Table/woodenWall");
        }
        
    }
}